package com.micro.modual.extension;

import com.micro.common.MicroConstant;
import com.micro.common.biz.GeneratorCodeUtil;
import com.micro.common.util.SnowFlakeUtil;
import com.micro.modual.entity.SystemPost;
import com.micro.modual.model.bo.systempost.SystemPostBO;

import java.util.Date;

/**
 * <h1>系统岗位表 延展类</h1>
 *
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:23:26
 */
public class SystemPostExtension {

    /**
     * <h2>转换: 系统岗位表 新增</h2>
     *
     * @param systemPostBO {@link SystemPostBO} 系统岗位表 新增/修改 请求对象
     * @return {@link SystemPost} 系统岗位表
     */
    public static SystemPost converAddSystemPost(SystemPostBO systemPostBO) {
        SystemPost systemPost = new SystemPost();
        systemPost.setId(SnowFlakeUtil.getId());
        systemPost.setPostCode(systemPostBO.getPostCode());
        systemPost.setPostName(systemPostBO.getPostName());
        systemPost.setPostSort(systemPostBO.getPostSort());
        systemPost.setPostDesc(systemPostBO.getPostDesc());
        systemPost.setPostStatus(systemPostBO.getPostStatus());
        systemPost.setCreateTime(new Date());
        return systemPost;
    }

    /**
     * <h2>转换: 系统岗位表 修改</h2>
     *
     * @param systemPostBO {@link SystemPostBO} 系统岗位表 新增/修改 请求对象
     * @return {@link SystemPost} 系统岗位表
     */
    public static SystemPost converEditSystemPost(SystemPostBO systemPostBO) {
        SystemPost systemPost = new SystemPost();
        systemPost.setId(systemPostBO.getId());
        systemPost.setPostCode(systemPostBO.getPostCode());
        systemPost.setPostName(systemPostBO.getPostName());
        systemPost.setPostSort(systemPostBO.getPostSort());
        systemPost.setPostDesc(systemPostBO.getPostDesc());
        systemPost.setPostStatus(systemPostBO.getPostStatus());
        systemPost.setUpdateTime(new Date());
        return systemPost;
    }
}
